﻿using Microsoft.Extensions.Hosting;
using IOP.Orleans.Server;
using System;
using Orleans.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using IOP.Orleans.Server.MessageHub;

namespace SimpleServerTest
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var host = new HostBuilder()
            .ConfigureAppConfiguration((context, config) => config.AddJsonFile("appsettings.json", true))
            .CreateOrleansServicesServer("TestServer", (context, siloBuilder) =>
            {
                siloBuilder.AddMessageHub();
                siloBuilder.ConfigureLogging((log) => log.SetMinimumLevel(LogLevel.Information).AddConsole());
                //siloBuilder.ConfigureEndpoints(new Random().Next(20001, 30000), new Random().Next(10000, 20000));
            });
            await host.RunConsoleAsync();
        }
    }
}
